﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TI_BAL;

namespace SecuritySystem
{
    public partial class SearchUser : UserControl
    {

        TIEntities dbContext;
        public SearchUser()
        {
            dbContext = new TIEntities();
            InitializeComponent();
            RefreshForm();
        }


        private void RefreshForm()
        {


            var userRole = (from uRole in dbContext.Roles
                            select new { ID = uRole.id, ROLE = uRole.role1 }).ToList();
            this.comboBoxRole.DataSource = userRole; //new BindingSource(getRoles(), null);
            this.comboBoxRole.DisplayMember = "ROLE";
            this.comboBoxRole.ValueMember = "ID";

            var userRoleDes = (from uRole in dbContext.RolesDescriptions
                               select new { ID = uRole.ID, ROLEDES = uRole.Role_Description }).ToList();
            this.comboBoxRoleDescription.DataSource = userRoleDes; //new BindingSource(getRoles(), null);
            this.comboBoxRoleDescription.DisplayMember = "ROLEDES";
            this.comboBoxRoleDescription.ValueMember = "ID";
            
        }

        private void radioButtonUserDetails_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radioButtonUserDetails.Checked == true) 
            {
                this.groupBoxBarCode.Enabled = false;
                this.groupBoxThumbImpression.Enabled = false;
                this.groupBoxUser.Enabled = true;

            }

        }

        private void radioButtonThumb_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radioButtonThumb.Checked == true)
            {
                this.groupBoxBarCode.Enabled = false;
                this.groupBoxThumbImpression.Enabled = true;
                this.groupBoxUser.Enabled = false;

            }

        }

        private void radioButtonBarCode_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radioButtonBarCode.Checked == true)
            {
                this.groupBoxBarCode.Enabled = true;
                this.groupBoxThumbImpression.Enabled = false;
                this.groupBoxUser.Enabled = false;



            }

        }

        private void buttonSearch_Click(object sender, EventArgs e)
        {


        

        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}
